<template>
  <div class="container">
    <comdsq :tableData="directorysarr" @ye="edd" :total="total" />
  </div>
</template>

<script>
import { directoryslist } from '../../api/base/directorys'
import comdsq from '../components/comdsq.vue'
export default {
  data () {
    return {
      directorysarr: [],
      total: 0,
      index: 1
    }
  },

  components: {
    comdsq
  },
  created () {

  },
  methods: {
    edd (a) {
      // console.log(a)
      this.directoryslist(a)
    },
    async directoryslist (a) {
      // console.log(a)
      const { data } = await directoryslist(
        a
      )
      // if (data.items.length === 0) {
      //   this.pageNum--
      //   this.directoryslist()
      //   return
      // }
      data.items.forEach(obj => {
        obj.index = this.index

        this.index++
      })
      this.index = 1
      this.directorysarr = data.items
      // console.log(this.directorysarr)
      this.total = data.counts
      // this.directorysarr = data.items
    }

  }
}
</script>

<style lang="scss" scoped>
</style>
